package br.com.miboco.patterns.strategy.buttons;

import java.util.ArrayList;
import java.util.Observable;
import java.util.Observer;

import br.com.miboco.patterns.observer.ButtonObservable;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.PushButton;
import com.google.gwt.user.client.ui.Composite;

/**
 * Abstract class that aims of figure out Button behaviour.
 * */
public abstract class ButtonStrategyComponent extends Composite{
	protected static final int BORDER_WIDTH = 0;
	protected static final int SPACING = 2;
	private ButtonObservable observableVisible;
	
	public ButtonStrategyComponent(ButtonObservable observableVisible){
		this.observableVisible = observableVisible;
	}
	
	/**
	 * add a new instance of button. 
	 * */
	public abstract void  add(PushButton pusshButton);
	
	/**
	 * add a new instance of button with vector of Images.
	 * */
	public abstract void addButtons(Image...img);
	
	/**
	 * returns a new list of buttons.
	 * */
	public ArrayList<PushButton> getPushButtons(){
		ArrayList<PushButton> buttons = new ArrayList<PushButton>();
		
		PushButton pushButtonSingle = new PushButton("single");
		pushButtonSingle.addStyleName("buttonsimple");
		
		PushButton pushButtonDashed = new PushButton("dashed");
		pushButtonDashed.addStyleName("buttondashed");
		
		PushButton pushButtonDoubleSolid = new PushButton("solid");
		pushButtonDoubleSolid.addStyleName("buttondoublesolid");
		
		PushButton pushButtonDoubleDashed = new PushButton("dashed");
		pushButtonDoubleDashed.addStyleName("buttondoubledashed");
		
		PushButton pushButtonWrap = new PushButton("->");
		pushButtonWrap.addStyleName("buttonwrap");
		
		pushButtonWrap.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				observableVisible.setVisible(false);
				
			}
		});
		
		buttons.add(pushButtonSingle);
		buttons.add(pushButtonDashed);
		buttons.add(pushButtonDoubleSolid);
		buttons.add(pushButtonDoubleDashed);
		buttons.add(pushButtonWrap);
		
		return buttons;
		
	}

	
	
	
	
}
